home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AOL File Library: 2,801 to 2,900
/
aol-file-protocol-4400-2801-to-2900.zip
/
AOLDLs
/
TAWUG
/
TAWUG Disk No. 56 (SHK)
/
TAWUG56.shk
/
DISK.COMMANDS
(
.txt
)
< prev
next >
Wrap
AppleWorks Document
|
1987-07-01
|
4KB
|
93 lines
O=====|====|====|====|====|====|====|====|====|====|====|====|====|====|====|===
USING DISK DRIVE COMMANDS IN MACHINE LANGUAGE
BY STEPHEN KILLOUGH
From Apple Computer Enjoyment Society
Fort Lauderdale, Florida"
Vol 3 No 3, May/June 1981
; Sometimes when programming in assembly language, it is D
Bnecessary to use one of the regular disk commands, such as BLOAD, D
BBSAVE, etc. The usual procedure is to have an accompanying BASIC B
@program handle the disk commands and call the machine routine. <
:Sometimes it would be more convenient, though, if it were D
Bpossible to use the disk without switching back and forth between 2
languages. Here is a method of doing just that.
B Basically, the method of controlling the disk by printing the @
>command with a CTRL-D in front of it is valid even in machine D
Blanguage, providing the printing is done by the COUT routine (see C
Apages 30 and 61 of the APPLE ][ REFERENCE MANUAL). Your machine <
:language routine should send out, one by one via the COUT A
?routine, the ConTRoL-D, and command characters, and the return <
character. An example of a machine language routine that +
would perform a "CATALOG" is shown below:
LDA #$84 ;code for CTRL-D#
JSR $FDED ;COUT address!
LDA #$C3 ;code for C
JSR $FDED !
LDA #$C1 ;code for A
JSR $FDED !
LDA #$D4 ;code for T
JSR $FDED !
LDA #$C1 ;code for A
JSR $FDED !
LDA #$CC ;code for L
JSR $FDED !
LDA #$CF ;code for O
JSR $FDED !
LDA #$C7 ;code for G
JSR #$FDED &
LDA #$8D ;carriage return
JSR #$FDED
B The hex codes for these characters can be found on page 7 of
the REFERENCE MANUAL.
? A more elaborate example shown here includes prompting to B
@ask the user which file is to be loaded. This routine uses the A
?GETLN routine (see pages 33 and 62 of the REFERENCE MANUAL) to C
Aget the prompted file name. This name, stored in locations $200 >
to $300, must be relocated before the output routine starts.
9000: LDY #$01 ;send out a "NAME?"
9002: LDX #$06 ;prompt
9004: LDA $90F0,Y
9007: JSR $FDED ;via COUT
900A: INY
900B: DEX)
900C: BNE $9004 ;get next character
900E: JSR $FD6F ;GETLN1 routine
9011: TXA
9012: TAY(
9013: LDA $0200,Y ;relocate filename
9016: STA $9098,Y ;to $9098-
9019: DEY)
901A: BNE $9013 ;get next character
901C: LDA $0200
901F: STA $9098
9022: CLC
9023: TXA
9024: ADC #$07
9026: TAX
9027: LDY #$01)
9029: LDA $9090,Y ;load "BLOAD file-"(
902C: JSR $FDED ;send out via COUT
902F: INY
9030: DEX
9031: BNE $9029 "
9033: LDA #$8D ;return code#
9035: JSR $FDED ;through COUT
9038: RTS
Character storage:
9091: 84 ;control-D char%
9092: C2 ; B char%
9093: CC ; L char%
9094: CF ; O char%
9095: C1 ; A char%
9096: C4 ; D char%
9097: A0 ; space char%
9098: ? ;filename chars$
9099: ? ; continued...
90A0: ?
90F1: CE ; N char"
90F2: C1 ; A char"
90F3: CD ; M char"
90F4: C5 ; E char"
90F5: BF ; ? char"
90F6: 8D ;return char